<template>
	<view class="bg-white">
		<u-navbar  autoBack placeholder leftIcon="close"></u-navbar>
		<view class="flex align-center justify-center flex flex-column" style="height: 500rpx;">
			<view class="font-md text-main">请设置您的支付密码</view>
			<view class="mt-5">
				<u-code-input v-model="pwd" dot size="49"></u-code-input>
			</view>
			
		</view>
		
		<commonButton title="提交"  @click="submit"></commonButton>
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				pwd:''
			}
		},
		methods:{
			submit(){
				if(this.pwd.length<6){
					return uni.showToast({
						title: '请输入6位支付密码',
						icon:'none'
					});
				}
				this.$api.paypwd({password:this.pwd}).then(res=>{
					if(res.code === 1){
						uni.showToast({
							title: '支付密码设置成功',
							icon:'success'
						});
						setTimeout(()=>{
							uni.navigateBack({
								delta: 1
							});
						},1000)
					}
				})
			}
		}
	}
</script>

<style>
</style>